#include "StdAfx.h"

Castbar* Singleton<Castbar>::m_instance = 0;

Castbar::Castbar()
{
	m_border = CTextureHandler::GetInstance()->GetTexture("Interface\\Castingbar\\UI-CastingBar-Flash.blp");
	m_bVertices[0].x = 100.0f;
	m_bVertices[0].y = 100.0f;
	m_bVertices[0].u = 20.0f / 256.0f;
	m_bVertices[0].v = 15.0f / 256.0f;

	m_bVertices[1].x = 315.0f;
	m_bVertices[1].y = 100.0f;
	m_bVertices[1].u = 235.0f / 256.0f;
	m_bVertices[1].v = 15.0f / 256.0f;

	m_bVertices[2].x = 315.0f;
	m_bVertices[2].y = 135.0f;
	m_bVertices[2].u = 235.0f / 256.0f;
	m_bVertices[2].v = 50.0f / 256.0f;

	m_bVertices[3].x = 100.0f;
	m_bVertices[3].y = 135.0f;
	m_bVertices[3].u = 20.0f / 256.0f;
	m_bVertices[3].v = 50.0f / 256.0f;
}

void Castbar::Draw()
{
	sD3D->SetFVF(VERTEX3FRHWT);
	sD3D->SetTexture(0, *m_border);
	sD3D->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, m_bVertices, sizeof(Vertex3FRHWT));
}